import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
//        创建客户端
        Socket socket = new Socket("127.0.0.1",1123);
//        获取网络输出流
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("send to service".getBytes());
        InputStream inputStream = socket.getInputStream();
        byte[]bytes = new byte[1024];
        int len = inputStream.read(bytes);
        System.out.println(new String(bytes,0,len));
        socket.close();
    }
}
